package com.construction_Safety.region.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.construction_Safety.common.annotation.Log;
import com.construction_Safety.common.core.controller.BaseController;
import com.construction_Safety.common.core.domain.AjaxResult;
import com.construction_Safety.common.enums.BusinessType;
import com.construction_Safety.region.domain.CRegionPicture;
import com.construction_Safety.region.service.ICRegionPictureService;
import com.construction_Safety.common.utils.poi.ExcelUtil;
import com.construction_Safety.common.core.page.TableDataInfo;

/**
 * 员工区域管理Controller
 * 
 * @author yat
 * @date 2025-11-10
 */
@RestController
@RequestMapping("/region/region_picture")
public class CRegionPictureController extends BaseController
{
    @Autowired
    private ICRegionPictureService cRegionPictureService;

    /**
     * 查询员工区域管理列表
     */
    @PreAuthorize("@ss.hasPermi('region:region_picture:list')")
    @GetMapping("/list")
    public TableDataInfo list(CRegionPicture cRegionPicture)
    {
        startPage();
        List<CRegionPicture> list = cRegionPictureService.selectCRegionPictureList(cRegionPicture);
        return getDataTable(list);
    }

    /**
     * 导出员工区域管理列表
     */
    @PreAuthorize("@ss.hasPermi('region:region_picture:export')")
    @Log(title = "员工区域管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CRegionPicture cRegionPicture)
    {
        List<CRegionPicture> list = cRegionPictureService.selectCRegionPictureList(cRegionPicture);
        ExcelUtil<CRegionPicture> util = new ExcelUtil<CRegionPicture>(CRegionPicture.class);
        util.exportExcel(response, list, "员工区域管理数据");
    }

    /**
     * 获取员工区域管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('region:region_picture:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(cRegionPictureService.selectCRegionPictureById(id));
    }

    /**
     * 新增员工区域管理
     */
    @PreAuthorize("@ss.hasPermi('region:region_picture:add')")
    @Log(title = "员工区域管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CRegionPicture cRegionPicture)
    {
        return toAjax(cRegionPictureService.insertCRegionPicture(cRegionPicture));
    }

    /**
     * 修改员工区域管理
     */
    @PreAuthorize("@ss.hasPermi('region:region_picture:edit')")
    @Log(title = "员工区域管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CRegionPicture cRegionPicture)
    {
        return toAjax(cRegionPictureService.updateCRegionPicture(cRegionPicture));
    }

    /**
     * 删除员工区域管理
     */
    @PreAuthorize("@ss.hasPermi('region:region_picture:remove')")
    @Log(title = "员工区域管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(cRegionPictureService.deleteCRegionPictureByIds(ids));
    }
}
